import apiurl from "./apiconfig.js";

const apilogin = {
    // 发送验证码(创建订单)
    createOrder(page, lpid, lpsl, cb) {
        let userinfo = JSON.parse(sessionStorage.getItem("userinfo"));
        var params = new URLSearchParams()
        params.append('userid', userinfo.vipcode);
        params.append('openid',userinfo.openid);
        params.append('lpid',lpid);
        params.append('lpsl',lpsl);
        page.$ajax.post(apiurl.createOrder, params)
            .then(res => {
                cb && cb(res)

            })
            .catch(err => console.log(err))
    },
    // 校验五元钱
    ck5yq(page, lpid, cb) {
        let userinfo = JSON.parse(sessionStorage.getItem("userinfo"));
        var params = new URLSearchParams()
        params.append('userid', userinfo.vipcode);
        params.append('openid',userinfo.openid);
        params.append('lpid',lpid);
        page.$ajax.post(apiurl.ck5yq, params)
            .then(res => {
                cb && cb(res)
            })
            .catch(err => console.log(err))
    }
};
export default apilogin
